<template>
  <Spin :spinning="loading" tip="Loading...">
  <div>
    <!-- table -->
    <!-- 技术报告录入 - 技术报告录入新增 -->
    <BreakSpace label="基本信息" :containerStyle="{ marginBottom: '10px' }" />
    <FormPanel ref="formPanel" :list="formList" :cols="3" :formType="'add'" labelWidth="140" :isSubmitBtn="false" @formChange="formChangeHandle" />
    <div style="margin-bottom: 1rem;"></div>
    <BreakSpace label="故障信息" :containerStyle="{ marginBottom: '10px' }" />
    <FilterTable
      ref="table"
      :columns="columns"
      :dataSource="dataList"
      :isPagination = false
      :onColumnsChange="columns => (this.columns = columns)"
      :onRowSelectChange="selectChange"
      height="auto"
      selectionType="single"
      :isSelectColumn=false
      :isColumnFilter="false"
    >
      <template slot="controls" slot-scope="props">
        <multiuse-button size="small" type="primary" icon="el-icon-plus" @click="addFaultInfoTurnOn()" >添加故障信息</multiuse-button>
      </template>
    </FilterTable>
    <div style="margin-bottom: 1rem;"></div>
    <FormPanel ref="formPanel2" :list="formList2" :cols="2" :formType="'add'" labelWidth="110" :isSubmitBtn="false" @formChange="formChangeHandle2" />
    <div style="margin-bottom: 1rem;"></div>
<!--    <BreakSpace label="经销商-车厂沟通历史" :containerStyle="{ marginBottom: '10px' }" />-->
<!--    <FilterTable-->
<!--      ref="table2"-->
<!--      :columns="columns2"-->
<!--      :params="fetchParams"-->
<!--      :dataSource="dataList2"-->
<!--      :datakey="'items'"-->
<!--      :onColumnsChange="columns => (this.columns2 = columns2)"-->
<!--      :onRowSelectChange="selectChange"-->
<!--      selectionType="single"-->
<!--    ></FilterTable>-->
<!--    <div style="margin-bottom: 1rem;"></div>-->
    <div style="padding-top: 3rem;"></div>
    <div
      :style="{
        position: 'fixed',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right'
      }"
    >
      <!--      <multiuse-button type="primary" @click="">作废</multiuse-button>-->
      <multiuse-button type="primary" :click="saveDialog.bind()">保 存</multiuse-button>
      <multiuse-button type="primary" :click="submit.bind()">提 交</multiuse-button>
      <multiuse-button @click="closeDialog">关 闭</multiuse-button>
    </div>
    <BaseDialog :visible.sync="VinVisible" :title="'Vin查询'" destroyOnClose width="850px" :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
      <VinVehicle @close="vinClose" @save="vinSave"></VinVehicle>
    </BaseDialog>
    <BaseDialog :visible.sync="AddFaultInfoVisible" :title="'添加故障信息'" destroyOnClose width="850px" :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
      <Vehicle @close="addFaultInfoClose" @save="addFaultInfoSave"></Vehicle>
    </BaseDialog>
    <BaseDialog :visible.sync="visibleVehicle" :title="'经销商选择'" destroyOnClose width="850px" :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
      <DealerList @close="closeVehicle" @save="saveVehicle"></DealerList>
    </BaseDialog>
    <BaseDialog :visible.sync="visibleVinNo" :title="'车型选择'" destroyOnClose width="850px" :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <ModelVehicle @close="closeVehicle" @save="modelSave"></ModelVehicle>
    </BaseDialog>
  </div>
  </Spin>
</template>
<script>
import VinVehicle from '@/pages/claimDemage/tools/VinVehicle.vue';
import DealerList from '@/pages/claimDemage/tools/DealerList.vue';
import Vehicle from './SymptomSelection.vue';
//字典
import { getPartType } from '@/api/dictionary/index';
//手机号校验
import { phone } from '@/utils/validate';
//后台请求
import { newSave, checkFirst ,checkExistsByVin }  from '@/api/technicalReportManagement/technicalSupportManagement_OEM/technicalReportEntry/index';
//时间格式化
import moment from "moment";
import { getAppId } from '@/assets/js/auth';
import { getVinList } from '@/api/dictionary';
import ModelVehicle from '@/pages/claimDemage/tools/ModelVehicle.vue';
export default {
  // mixins: [dictionary],
  components: {
    VinVehicle,
    ModelVehicle,
    DealerList,
    Vehicle
  },
  data() {
    return {
      loading: false,
      dataList: [],
      columns: this.creatHeader(),
      // dataList2: [],
      // columns2: this.creatHeader2(),
      saveFlag: 55521002,
      VinVisible: false,
      AddFaultInfoVisible: false,
      EditFaultInfoVisible: false,
      visibleVehicle: false,
      visibleVinNo: false,
      fetchParams: {}, //ipa 接口
      selectedRows: [], //选中经销商
      formList: this.createFormList(),
      formList2: this.createFormList2(),
      saveData: null,
      saveData2: null,
      //保存方法变量
      //车型ID
      modelId: null,
      //车型代码
      modelCode: null
    };
  },
  created() {
    this.loading = true;
    this.chuqi();

  },
  methods: {
    async chuqi() {
      //是否首次咨询
      const res1 = await getPartType({type: 5500});
      if (res1.resultCode == 200) {
        this.formList.find(x => x.fieldName == 'ifFirst').initialValue = 55001001;
        this.formList.find(x => x.fieldName == 'ifFirst').itemList = res1.data.map(y => ({
          text: y.codeCnDesc,
          value: y.codeId
        }));
      }
      //状态
      const res2 = await getPartType({type: 5552});
      if (res2.resultCode == 200) {
        this.formList.find(x => x.fieldName == 'techStatus').initialValue = 55521002;
        this.formList.find(x => x.fieldName == 'techStatus').itemList = res2.data.map(y => ({
          text: y.codeCnDesc,
          value: y.codeId
        }));
      }
      //受理类型
      const res3 = await getPartType({type: 5553});
      if (res3.resultCode == 200) {
        // this.formList2.find(x => x.fieldName == 'acceptType').initialValue = '';
        this.formList2.find(x => x.fieldName == 'acceptType').itemList = res3.data.map(y => ({
          text: y.codeCnDesc,
          value: y.codeId
        }));
      }
      //必填项控制
      if (getAppId() == 'arcfox') {
        this.formList.find(x => x.fieldName == 'dcTel').rules[0].required = true;
        this.formList.find(x => x.fieldName == 'dcTel').rules[0].validator = phone;
      }
      this.loading = false;
    },
    modelSave(obj) {
      this.formList.find(x => x.fieldName == 'modelName').initialValue = obj[0].modelName;
      this.modelCode=obj[0].modelCode;
      // this.modelId = obj[0].modelId;
      console.log("!!!!!!!!!",this.modelCode)
      this.visibleVinNo = false;
    },
    deleteHandle(val) {
      this.$refs.table.$refs.pageTable.EXECUTE_DELETE([val]);
    },
    formChangeHandle(val) {
      console.log(val);
      this.saveData = val;
    },
    formChangeHandle2(val) {
      console.log(val);
      this.saveData2= val;
    },
    //搜索获取数据
    changeHandle
    (val) {
      this.fetchParams = val;
      console.log(val);
    },
    //选中
    selectChange(rows) {
      this.selectedRows = rows;
      console.log(this.selectedRows);
    },
    //保存
    async saveDialog() {

      this.saveFlag = 55521002;

      this.formList[6].rules[0].required = false;
      this.formList[7].rules[0].required = false;
      // this.formList[9].rules[0].required = false;
      // this.formList[11].rules[0].required = false;

      this.formList2[0].rules[0].required = false;
      this.formList2[2].rules[0].required = false;
      this.formList2[3].rules[0].required = false;
      this.formList2[4].rules[0].required = false;
      this.formList2[5].rules[0].required = false;

      this.$refs.formPanel.SUBMIT_FORM();
      this.$refs.formPanel2.SUBMIT_FORM();

      console.log('newSave',this.saveData)
      console.log('newSave2',this.saveData2)

      //单据状态 技术报告草稿，提交 字典码
      let save = {};
      save = Object.assign({}, this.saveData, this.saveData2);
      let fileList = [];

      this.saveData2.applyFileList.map((x) => {
        fileList.push({ title: x.name, fileUrl: x.url , type: 55511001});
      });

      save.techStatus = this.saveFlag;
      // save.modelId = this.modelId;
      save.modelCode = this.modelCode;
      save.applyFileList = fileList
      save.faultList = this.dataList;
      if (this.saveFlag === 55521003) {
        save.firstDate = moment(this.firstDate).format('YYYY-MM-DD HH:mm:ss');
      }

      //保存前格式化时间类型
      //销售日期
      if (this.saveData.saleDate != null && this.saveData.saleDate != "") {
        save.saleDate = moment(this.saveData.saleDate).format('YYYY-MM-DD HH:mm:ss');
      } else {
        save.saleDate = null;
      }

      //生产日期
      if (this.saveData.prodDate != null && this.saveData.prodDate != "") {
        save.prodDate = moment(this.saveData.prodDate).format('YYYY-MM-DD HH:mm:ss');
      } else {
        save.prodDate = null;
      }

      this.loading = true;
      let res = await newSave(save);
      console.log(res);
      if (res.resultCode === 200) {
        this.$emit('save');
        return this.$notify.success({title: '提示信息', message: '保存成功'});
      } else {
        this.loading = false;
         this.$notify.error({title: '提示信息', message: res.errMsg || '保存失败!'});
        // this.closeDialog();
      }
    },
    //提交
    async submit() {
      console.log("nihao")
      this.formList[3].rules[0].required = true;
      this.formList[6].rules[0].required = true;
      this.formList[7].rules[0].required = true;
      // this.formList[9].rules[0].required = true;
      // this.formList[11].rules[0].required = true;

      this.formList2[0].rules[0].required = true;
      this.formList2[2].rules[0].required = true;
      this.formList2[3].rules[0].required = true;
      this.formList2[4].rules[0].required = true;
      //this.formList2[5].rules[0].required = true;

      this.saveFlag = 55521003;
      this.firstDate = new Date;
      let bool = true;
      let bool2 = true;
      console.log("one")
      //if (this.dataList.length > 0) {
        let tableList = this.$refs.table.$refs.pageTable.list;
        if (getAppId() == 'beijing') {
          tableList.map((x) => {
            if (x.errorCode) {
              if (!x.faultCondition) {
                bool2 = false;
              }
            }
          });
            tableList.map((x) => {
              if (x.faultCondition) {
              if (!x.errorCode) {
                  bool = false;
                }
               }
            });
        } else {
          tableList.map((x) => {
            if (x.errorCode == "") {
              bool = false;
            }
          });

          tableList.map((x) => {
            if (x.faultCondition == "") {
              bool2 = false;
            }
          });
        }
        console.log(123);
        if (bool === false) {
          return this.$notify.error({title: '提示信息', message: '请填写故障码后再进行提交！'});
        }
        if (bool2 === false) {
          return this.$notify.error({title: '提示信息', message: '请填写故障触发条件后再进行提交！'});
        }
        // if (this.formList.find(x => x.fieldName == 'vin').initialValue.length < 17) {
        //   return this.$notify.error({title: '提示信息', message: 'Vin必须大于等于17位！'});
        // }
        // let vin = await getVinList({appId: getAppId(),vin: this.formList.find(x => x.fieldName == 'vin').initialValue,current:1,currentPage:1,limit:20,pageNum:1,pageSize:20,size:20});
        // if (vin.data.records.length <= 0) {
        //   return this.$notify.error({title: '提示信息', message: 'Vin输入错误！'});
        // }
        if (bool === true && bool2 === true) {
        console.log("three")
          if (this.$refs.formPanel.SUBMIT_FORM()) {
            this.$refs.formPanel2.SUBMIT_FORM();

            console.log('newSave', this.saveData)
            console.log('newSave2', this.saveData2)

            //单据状态 技术报告草稿，提交 字典码
            let save = {};
            save = Object.assign({}, this.saveData, this.saveData2);
            let fileList = [];

            this.saveData2.applyFileList.map((x) => {
              fileList.push({title: x.name, fileUrl: x.url, type: 55511001});
            });

            save.techStatus = this.saveFlag;
            // save.modelId = this.modelId;
            save.modelCode = this.modelCode;
            save.applyFileList = fileList
            save.faultList = this.dataList;
            if (this.saveFlag === 55521003) {
              save.firstDate = moment(this.firstDate).format('YYYY-MM-DD HH:mm:ss');
            }

            //保存前格式化时间类型
            //销售日期
            if (this.saveData.saleDate != null && this.saveData.saleDate != "") {
              save.saleDate = moment(this.saveData.saleDate).format('YYYY-MM-DD HH:mm:ss');
            } else {
              save.saleDate = null;
            }

            //生产日期
            if (this.saveData.prodDate != null && this.saveData.prodDate != "") {
              save.prodDate = moment(this.saveData.prodDate).format('YYYY-MM-DD HH:mm:ss');
            } else {
              save.prodDate = null;
            }

            this.loading = true;
            let res = await newSave(save);
            console.log(res);
            if (res.resultCode === 200) {
              this.$emit('save');
              return this.$notify.success({title: '提示信息', message: '提交成功!'});
            } else {
              this.loading = false;
              this.$notify.error({title: '提示信息', message: res.errMsg || '提交失败!'});
              // this.closeDialog();
            }
          }

        }

      // } else {
        // return this.$notify.error({title: '提示信息', message: '请添加故障信息后再进行提交！'});
      // }

    },
    //取消操作
    closeDialog() {
      this.$emit('close');
    },
    vinTurnOn() {
      this.VinVisible = true;
    },
    addFaultInfoTurnOn() {

      // if (this.formList.find(x => x.fieldName == 'vin').initialValue) {
        this.AddFaultInfoVisible = true;
      // } else {
      //   this.$notify.error({title: '提示信息', message: '请先选择Vin'});
      // }

    },
    vinClose(){
      this.VinVisible = false;
    },
    addFaultInfoClose(){
      this.AddFaultInfoVisible = false;
    },
    async vinSave(obj) {
      this.formList.find(x => x.fieldName == 'vin').initialValue = obj[0].vin;
      this.formList.find(x => x.fieldName == 'modelName').initialValue = obj[0].modelName;
      this.formList.find(x => x.fieldName == 'prodDate').initialValue = obj[0].prodDate;
      this.formList.find(x => x.fieldName == 'saleDate').initialValue = obj[0].saleDate;
      this.formList.find(x => x.fieldName == 'licenseNo').initialValue = obj[0].licenseNo;
      this.modelId = obj[0].modelId;
      this.modelCode = obj[0].modelCode;
      this.$refs.table.$refs.pageTable.EXECUTE_DELETE(this.$refs.table.$refs.pageTable.list);
      let newVar = await checkExistsByVin({vin: obj[0].vin});
      if (newVar.resultCode === 200 && newVar.data > 0) {
        this.formList.find(x => x.fieldName == 'ifFirst').initialValue = 55001002;
      } else {
        this.formList.find(x => x.fieldName == 'ifFirst').initialValue = 55001001;
      }
      this.VinVisible = false;
    },
    async addFaultInfoSave(val) {

      let vin = this.formList.find(x => x.fieldName == 'vin').initialValue;
      if (vin) {
        let newVar = await checkFirst({vin: vin, faultCode: val[0].faultCode});
        if (newVar.data == 0) {
          val[0].ifFirstStr = '是';
          val[0].ifFirst = 55001001;
        } else {
          val[0].ifFirstStr = '否';
          val[0].ifFirst = 55001002;
        }
      } else {
        val[0].ifFirstStr = '否';
        val[0].ifFirst = 55001002;
      }
      this.$refs.table.$refs.pageTable.EXECUTE_INSERT(val);
      this.AddFaultInfoVisible = false;
      this.fetchParams = {...this.fetchParams};
    },
    chooseOrderNo() {
      this.visibleVehicle = true;
    },
    chooseVinNo() {
      this.visibleVinNo = true;
    },
    closeVehicle() {
      this.visibleVehicle = false;
      this.visibleVinNo = false;
      this.fetchParams = { ...this.fetchParams };
    },
    saveVehicle(obj) {
      this.visibleVehicle = false;
      this.formList.find(x => x.fieldName == 'dealerCode').initialValue = obj[0].dealerCode;
      this.formList.find(x => x.fieldName == 'dealerName').initialValue = obj[0].dealerShortname;
      this.formList.find(x => x.fieldName == 'belongArea').initialValue = obj[0].deptName;
      this.fetchParams = { ...this.fetchParams };
    },
    //基本信息
    createFormList() {
      return [
        {
          type: 'INPUT',
          label: '技术报告单号',
          fieldName: 'techNo',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'SELECT',
          label: '状态',
          fieldName: 'techStatus',
          itemList: [],
          initialValue: 55521002,
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'SELECT',
          label: '是否首次咨询',
          fieldName: 'ifFirst',
          itemList: [],
          initialValue: 55001001,
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '经销商代码',
          fieldName: 'dealerCode',
          readonly: true, // 只读
          rules: [{required: true, message: '请选择经销商', trigger: 'change'}],
          unitRender: p => {
            return (
              <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.chooseOrderNo()}/>
              </div>
            );
          }
        },
        {
          type: 'INPUT',
          label: '经销商名称',
          fieldName: 'dealerName',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '所属区域',
          fieldName: 'belongArea',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '经销商联系人',
          fieldName: 'dcPerson',
          rules: [{required: true, message: '请输入经销商联系人', trigger: 'blur'}],
          placeholder: '请输入...'
        },
        {
          type: 'INPUT',
          label: '经销商联系人电话',
          fieldName: 'dcTel',
          maxlength: 11,
          rules: [{required: true, message: '请输入联系电话', trigger: 'blur'}],
          placeholder: '请输入...'
        },
        {
          type: 'INPUT',
          label: '提交时间',
          fieldName: 'firstDate',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: 'VIN',
          fieldName: 'vin',
          placeholder: '请选择VIN',
          // readonly: false, // 只读
          // rules: [{required: true, message: '请选择VIN', trigger: 'change'}],
          rules: [],
          change: async val => {
            this.$refs.table.$refs.pageTable.EXECUTE_DELETE(this.$refs.table.$refs.pageTable.list);
            let newVar = await checkExistsByVin({vin: val});
            if (newVar.resultCode === 200 && newVar.data > 0) {
              this.formList.find(x => x.fieldName == 'ifFirst').initialValue = 55001002;
            } else {
              this.formList.find(x => x.fieldName == 'ifFirst').initialValue = 55001001;
            }
          },
          unitRender: p => {
            return (
              <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.vinTurnOn()}/>
              </div>
            );
          }
        },
        {
          type: 'INPUT',
          label: '车型',
          fieldName: 'modelName',
          readonly: true,// 只读
          // disabled: true, // 置会
          unitRender: p => {
            return (
              <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.chooseVinNo()} />
              </div>
            );
          }
        },
        {
          type: 'INPUT',
          label: '行驶里程',
          fieldName: 'driveMile',
          // rules: [{required: true, message: '请输入行驶里程...', trigger: 'blur'}, {
          //   pattern: /^[0-9]*$/,
          //   message: '请输入数字',
          //   trigger: 'blur'
          // }],
          placeholder: '请输入...',
          unitRender: () => {
            return <span>(KM)</span>;
          },
        },
        {
          type: 'DATE',
          label: '生产日期',
          fieldName: 'prodDate',
          valueFormat: 'yyyy-MM-dd',
          dateType: 'datetime',
          // readonly: true,// 只读
          // disabled: true // 置会
        },
        {
          type: 'DATE',
          label: '销售日期',
          fieldName: 'saleDate',
          valueFormat: 'yyyy-MM-dd',
          dateType: 'datetime',
          // readonly: true,// 只读
          // disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '车牌号',
          fieldName: 'licenseNo'
        }
      ];
    },
    //故障信息
    creatHeader() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          fixed: 'left',
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '操作',
          dataIndex: 'column-action',
          width: 100,
          render: props => {
            return (
              <div style="text-align:center">
                <multiuse-button type="text"  onClick={() => this.deleteHandle(props.row)}>
                  删除
                </multiuse-button>
              </div>
            );
          }
        },
        { title: '一级故障', dataIndex: 'sysName1', sorter: true },
        { title: '二级故障', dataIndex: 'sysName2', sorter: true },
        { title: '三级故障', dataIndex: 'sysName3', sorter: true },
        { title: '故障名称', dataIndex: 'sysName4', sorter: true },
        { title: '故障现象代码', dataIndex: 'faultCode', sorter: true },
        { title: '故障现象名称', dataIndex: 'faultName', sorter: true },
        { title: '故障Id', dataIndex: 'faId', sorter: true, hidden: true },
        {
          title: '故障码',
          dataIndex: 'errorCode',
          sorter: true,
          minWidth: 120,
          editable: true,
          defaultEditable: true,
          showOverflowTooltip: true,
          editType: 'input',
          // editRequired: true,
          placeholder: '请填写故障码...',
          // rules: [{ required: true, message: '请填写故障码', trigger: 'blur' }]
        },
        {
          title: '故障码触发条件',
          dataIndex: 'faultCondition',
          minWidth: 120,
          editable: true,
          defaultEditable: true,
          showOverflowTooltip: true,
          editType: 'input',
          // editRequired: true,
          placeholder: '请填写故障码触发条件...',
          // rules: [{ required: true, message: '请填写故障码触发条件', trigger: 'blur' }]
        },
        { title: '本车是否首发', dataIndex: 'ifFirst', sorter: true, hidden: true },
        { title: '本车是否首发', dataIndex: 'ifFirstStr', sorter: true },
        {
          title: '备注',
          dataIndex: 'remarks',
          sorter: true,
          minWidth: 120,
          editable: true,
          defaultEditable: true,
          showOverflowTooltip: true,
          editType: 'input',
          placeholder: '请填写备注...'
        }
      ];
    },
    createFormList2() {
      return [
        {
          type: 'SELECT',
          label: '受理类型',
          fieldName: 'acceptType',
          placeholder: '请选择',
          itemList: [],
          rules: [{ required: true, message: '请选择受理类型', trigger: 'change' }],
          change: val => {
            if (val == 55531004) {
              this.formList2.map(y => {
                if (y.fieldName == 'techInfos') {
                  y.rules = [{required: true, message: '请输入说明', trigger: 'change'}];
                }
              })
            }
            if (val == 55531002) {
              if (getAppId() == 'beijing') {
              this.formList.map(y => {
                if (y.fieldName == 'vin') {
                  y.rules = [{required: true, message: '请输入vin', trigger: 'change'}];
                }
              })
            }
            }
            else {
              this.formList2.map(y => {
                if (y.fieldName == 'techInfos') {
                  y.rules = [{required: false, message: '请输入说明', trigger: 'change'}];
                }
              })
              this.formList.map(y => {
                if (y.fieldName == 'vin') {
                  y.rules = [{required: false, message: '请输入vin', trigger: 'change'}];
                }
              })
            }
          }
        },
        {
          type: 'INPUT',
          label: '说明',
          fieldName: 'techInfos',
          initialValue: '',
          rules: [],
          rows: 2
        },
        {
          type: 'TEXT_AREA',
          label: '故障现象描述',
          fieldName: 'faultInfo',
          rules: [{required: true, message: '请输入故障现象描述', trigger: 'change'}],
          selfCols: 2,// 元素占据几行
          rows: 2
        },
        {
          type: 'TEXT_AREA',
          label: '检修经过',
          fieldName: 'cmsClaimProcess',
          rules: [{required: true, message: '请输入检修经过', trigger: 'change'}],
          selfCols: 2,// 元素占据几行
          rows: 2
        },
        {
          type: 'TEXT_AREA',
          label: '维修结果',
          fieldName: 'cmsClaimResult',
          rules: [{required: true, message: '请输入维修结果', trigger: 'change'}],
          selfCols: 2,// 元素占据几行
          rows: 2
        },
        {
          type: 'TEXT_AREA',
          label: '故障系统',
          fieldName: 'modelId',
          rules: [{required: true, message: '请输入故障系统', trigger: 'change'}],
          selfCols: 2,// 元素占据几行
          rows: 2
        },
        {
          type: 'UPLOAD_FILE',
          label: '上传文件',
          fieldName: 'applyFileList',
          placeholder: '上传文件...',
          // rules: [{ required: true, message: '请上传文件', trigger: 'change' }],
          initialValue: [],
          upload: {
            actionUrl: '/api/file/oss/upload',
            limit: 10,
            tipText: '（支持PDF、RAR、JPG格式）',
            max:1024*200
          }
        }
      ];
    },
    //经销商-车厂沟通历史
    // creatHeader2() {
    //   return [
    //     {
    //       title: '序号',
    //       dataIndex: 'index',
    //       width: 80,
    //       sorter: true,
    //       render: props => {
    //         return <span>{props.row.index + 1}</span>;
    //       }
    //     },
    //     { title: '经销商人员', dataIndex: 'date1', sorter: true },
    //     { title: '经销商提交时间', dataIndex: 'date2', sorter: true },
    //     { title: '故障现象描述', dataIndex: 'da7t73e', sorter: true },
    //     { title: '检修经过', dataIndex: 'da45te', sorter: true },
    //     { title: '维修结果', dataIndex: 'date6', sorter: true },
    //     { title: '车厂处理人', dataIndex: 'dat3e', sorter: true },
    //     { title: '车厂处理时间', dataIndex: 'dat6e', sorter: true },
    //     { title: '维修方案', dataIndex: 'dat73e', sorter: true },
    //     { title: '附件', dataIndex: 'da7te', sorter: true },
    //   ];
    // }
  }
};
</script>

<style lang="less" scoped></style>
